/*
Copyright 2010  Murali Devi (profdevi@gmail.com)

This file is part of ComineGL Project.

ComineGL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

ComineGL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ComineGL.  If not, see <http://www.gnu.org/licenses/>.

This code uses the irrlicht and irrklang libraries.  Please read
the libraries copyrights at 

	irrlicht library:  http://irrlicht.sourceforge.net
	irrklang library:  http://www.ambiera.com/irrklang

*/



//v0.16 copyright Comine.com 20110925U21
#include "MStdLib.h"
#include "Global.h"
#include "ComineGLInput.h"


//***********************************************
//** Exported Functions
//***********************************************
MDLLFUN bool CGLKeyIsPressed(ComineGLInputKeyCodes keycode)
	{
	if(GlobalInitialized==false)
		{
		MStdPrintf("**Engine is not initialized\n");
		return false;
		}

	if(GlobalEventInput.IsKeyPressed(keycode)==false)
		{
		return false;
		}

	return true;
	}


//////////////////////////////////////////////////
MDLLFUN bool CGLMouseGetPosition(int &x,int &y)
	{
	if(GlobalInitialized==false)
		{
		MStdPrintf("**Engine is not initialized\n");
		return false;
		}

	if(GlobalEventInput.GetMousePosition(x,y)==false)
		{
		return false;
		}

	return true;
	}


//////////////////////////////////////////////////
MDLLFUN bool CGLMouseGetDeltaPosition(int &dx,int &dy)
	{
	if(GlobalInitialized==false)
		{
		MStdPrintf("**Engine is not initialized\n");
		return false;
		}

	if(GlobalEventInput.GetMouseDelta(dx,dy)==false)
		{
		return false;
		}

	return true;
	}


/////////////////////////////////////////////////////
MDLLFUN bool CGLMouseIsLeftPressed(void)
	{
	if(GlobalInitialized==false)
		{
		MStdPrintf("**Engine is not initialized\n");
		return false;
		}

	return GlobalEventInput.IsMouseLeftPressed();	
	}


/////////////////////////////////////////////////////
MDLLFUN bool CGLMouseIsRightPressed(void)
	{
	if(GlobalInitialized==false)
		{
		MStdPrintf("**Engine is not initialized\n");
		return false;
		}

	return GlobalEventInput.IsMouseRightPressed();	
	}



